<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //symbol作为属性名
        let s1=Symbol("这是一个标签");
        let s2=Symbol("这是一个标签");
        let obj={
            [s1]:100,  //使用[]号
            [Symbol()]:200
        }
        obj[s2]=300;  //使用[]号
        console.log(obj[s1]);  //使用[]号

        //获得描述信息
        console.log(s1.description);
        //转字符
        console.log(s1.toString());
        //转boolean,恒为真
        console.log(!!s1);
        //注意：symbol类型不参与任何运算，否则报错
        console.log(s1+s2);
    </script>
</body>
</html>